Hi Tom,
I think I previously mentioned that my application sometimes deadlocks in KMotion library calls when the USB cable is unplugged/replugged. I did some more debugging, and found that making the following changes seems to fix the problem. I'm using KMotion
4.31f.
1) In KMotionDLL.cpp, in CKMotionDLL::GetStatus, I added "ReleaseToken();" before four occurrence of "return 1;". Apparently the application sometimes called GetStatus at about the same time the board disconnected, which caused GetStatus to return an
error without releasing the token.
2) in KMotionIO.cpp, in CKMotionIO::ReleaseToken, made the following change. Apparently, under certain conditions when unplugging / replugging the USB connector, Token became less than zero, which caused KMotionLock to return KMOTION_IN_USE
void CKMotionIO::ReleaseToken()
{
Mutex->Lock();
Token--;
if (Token < 0) Token=0; // ADDED THIS LINE TO ENFORCE Token >= 0
Mutex->Unlock();
}
Regards,
Toby
The information contained in this transmission is intended only for the person or entity
to which it is addressed and may contain II-VI Proprietary and/or II-VI Business Sensitive
material. If you are not the intended recipient, please contact the sender immediately
and destroy the material in its entirety, whether electronic or hard copy. You are
notified that any review, retransmission, copying, disclosure, dissemination or other
use of, or taking of any action in reliance upon this information by persons or entities
other than the intended recipient is prohibited.